<template>
  <div class="article-card">
    <div class="article-cover" v-if="article.coverImage">
      <img :src="article.coverImage" :alt="article.title">
    </div>
    <div class="article-content">
      <h3 class="article-title">
        <router-link :to="'/cms/article/' + article.articleId">{{ article.title }}</router-link>
      </h3>
      <p class="article-summary">{{ article.summary }}</p>
      <div class="article-meta">
        <span class="meta-item">
          <i class="el-icon-user"></i>
          {{ article.author }}
        </span>
        <span class="meta-item">
          <i class="el-icon-time"></i>
          {{ parseTime(article.publishTime) }}
        </span>
        <span class="meta-item">
          <i class="el-icon-view"></i>
          {{ article.viewCount }}
        </span>
        <span class="meta-item">
          <i class="el-icon-chat-dot-round"></i>
          {{ article.commentCount }}
        </span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ArticleCard',
  props: {
    article: {
      type: Object,
      required: true
    }
  }
}
</script>

<style scoped>
.article-card {
  display: flex;
  padding: 20px 0;
  border-bottom: 1px solid #eee;
}

.article-cover {
  flex: 0 0 200px;
  margin-right: 20px;
}

.article-cover img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
}

.article-content {
  flex: 1;
}

.article-title {
  margin: 0 0 10px;
  font-size: 18px;
}

.article-title a {
  color: #333;
  text-decoration: none;
}

.article-title a:hover {
  color: #409EFF;
}

.article-summary {
  margin: 10px 0;
  color: #666;
  line-height: 1.6;
}

.article-meta {
  display: flex;
  font-size: 12px;
  color: #999;
}

.meta-item {
  margin-right: 15px;
}

.meta-item i {
  margin-right: 3px;
}

@media (max-width: 768px) {
  .article-card {
    flex-direction: column;
  }
  
  .article-cover {
    flex: 0 0 auto;
    margin-right: 0;
    margin-bottom: 15px;
  }
  
  .article-cover img {
    width: 100%;
    height: auto;
  }
}
</style>
